package com.shuqi.model.sharedprefs;

import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;

import com.shuqi.common.utils.Log4an;
import com.shuqi.common.utils.SharedPreferenceUtil;

public class WebDomains {
    private static WebDomains webDomains;
    private final String logTag = "WebDomains";

    private WebDomains() {}

    public static WebDomains getInstence() {
        if (webDomains == null) {
            webDomains = new WebDomains();
        }
        return webDomains;
    }
    
    /**
     * 获取书旗自己的域名，这些域名下需要添加客户端参数
     */
    public String getShuqiWebDomains(Context context){
        SharedPreferences sp =
                context.getSharedPreferences(SharedPreferenceUtil.SP_NAME_WEBURLS,Context.MODE_PRIVATE);
        return sp.getString("webDomains","");
    }
    public boolean saveShuqiWebDmains(Context context,String domains){
        if (!TextUtils.isEmpty(domains)) {
            SharedPreferences sp =
                    context.getSharedPreferences(SharedPreferenceUtil.SP_NAME_WEBURLS,
                            Context.MODE_PRIVATE);
            sp.edit().putString("webDomains", domains).commit();
            Log4an.e(logTag , "webDomains数据：保存完成");
        }
        return false;
    }
}
